<form action="" method="get" class="user_search_form">
    <table>
        <tr>
            <td>用户名:</td>
            <td><input name="name" class="f1 easyui-textbox" data-options="required:true"></td>
        </tr>
        <tr>
            <td></td>
            <td><input type="submit" value="搜索"></td>
        </tr>
    </table>
</form>

<div class="easyui-pagination user_search_pager" data-options="pageSize:50">
</div>


<script type="text/javascript">
(function(){
    $('form.user_search_form').form({
        onSubmit: function(options){
            var options=$(this).form('options');
            var isValid = $(this).form('validate');
            if (isValid){
                console.log(options.url);
                var params=$(this).serializeArray();
                $.sget(options.url,params,function(data){
                    flatArray(data.content)
                    console.log(data.content);

                    $('.user_search_result').datagrid('loadData',data.content);
                });
            }
            return false;
        }
    });
    $('.user_search_pager').pagination({
        onSelectPage:function(pageNumber, pageSize){
            $(this).pagination('loading');
            search(pageNumber);
            $(this).pagination('loaded');
        }
    });
    function search(page){
        $('form.user_search_form').form('submit', {
            url:'/api/admin/customers?page='+Math.max(page-1,0),
        });
    }
    search(1);
})();

</script>